package com.test;

import java.util.Date;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;

import com.liferay.counter.service.CounterLocalServiceUtil;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
import com.slayer.model.LMSBook;
import com.slayer.model.impl.LMSBookImpl;
import com.slayer.service.LMSBookLocalServiceUtil;

/**
 * Portlet implementation class SVNPortlet
 */
public class SVNPortlet extends MVCPortlet {
	public void updateBook(ActionRequest actionRequest , ActionResponse actionResponse)
	{
		String bookTitle = ParamUtil.getString(actionRequest, "bookTitle");
		
		String author = ParamUtil.getString(actionRequest, "Author");
		
		//LogFactoryUtil.getLog(author);
		
	System.out.println("booktitle//"+bookTitle+"///author...."+author);
		
		//String authortwo = ParamUtil.getString(actionRequest,"author");
	
	
	LMSBook lmsBook = new LMSBookImpl();
	
	long bookId = 01;
	try
	{
		bookId =CounterLocalServiceUtil.increment();
	}
	catch(SystemException e)
	{
	e.printStackTrace();	
	}
	
	lmsBook.setBookId(bookId);
	lmsBook.setBookTitle(bookTitle);
	lmsBook.setAuthor(author);
	lmsBook.setCreateDate(new Date());
	
	try{
		lmsBook = LMSBookLocalServiceUtil.addLMSBook(lmsBook);
	}
	catch(SystemException e)
	{
		e.printStackTrace();
	}
	}

}
